import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/login.vue'
import Signup from '../views/signup.vue'
import Manager from '../views/Manager.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: Login
  },
  {
    path: '/signup',
    name: 'signup',
    component: Signup
  },
  {
    path: '/Manager',
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Manager.vue'),
    redirect:"/Manager/HomeView",
    children:[
      {path:'HomeView',name:'首页面', component: () => import(/* webpackChunkName: "about" */ '../views/HomeView.vue')},
      {path:'Pet',name:'宠物', component: () => import(/* webpackChunkName: "about" */ '../views/Pet.vue')},
      {path:'User',name:'用户', component: () => import(/* webpackChunkName: "about" */ '../views/User.vue')},
      {path:'Transfer',name:'交易信息', component: () => import(/* webpackChunkName: "about" */ '../views/Transfer.vue')},
      {path:'LoginDetails',name:'登录信息', component: () => import(/* webpackChunkName: "about" */ '../views/LoginDetails.vue')}
    ]
  }
];
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
});

export default router
